/**用来做权限校验
 * */
import types from '../action-types'

const initState = {
    pending: true,
    logged: false,
    token: "",
    pspsps: "dfdfd",
};

export default (state = initState, action) => {
    switch (action.type) {
        case types.START_LOGGED_USER:
            return {
                ...state,
                pending: true,
                logged: false,
                token: "",
            };
        case types.SUCCESS_LOGGED_USER:
            return {
                ...state,
                pending: false,
                logged: true,
                token: action.token,
            };
        case types.FAILED_LOGGED_USER:
            return {
                ...state,
                pending: false,
                logged: false,
                token: "",
            };


        default:
            return state;
    }
}
